home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / CGI / DOWNLOAD.CGI-S=FORMMAIL&C=TXT&F=FORMMAIL.PL < prev    next >
Perl Script  |  1996-06-03  |  24KB  |  636 lines

  1. #!/usr/bin/perl
  2. ##############################################################################
  3. # FormMail                        Version 1.6                                #
  4. # Copyright 1995-1997 Matt Wright mattw@worldwidemart.com                    #
  5. # Created 06/09/95                Last Modified 05/02/97                     #
  6. # Matt's Script Archive, Inc.:    http://www.worldwidemart.com/scripts/      #
  7. ##############################################################################
  8. # COPYRIGHT NOTICE                                                           #
  9. # Copyright 1995-1997 Matthew M. Wright  All Rights Reserved.                #
  10. #                                                                            #
  11. # FormMail may be used and modified free of charge by anyone so long as this #
  12. # copyright notice and the comments above remain intact.  By using this      #
  13. # code you agree to indemnify Matthew M. Wright from any liability that      #
  14. # might arise from its use.                                                  #
  15. #                                                                            #
  16. # Selling the code for this program without prior written consent is         #
  17. # expressly forbidden.  In other words, please ask first before you try and  #
  18. # make money off of my program.                                              #
  19. #                                                                            #
  20. # Obtain permission before redistributing this software over the Internet or #
  21. # in any other medium.    In all cases copyright and header must remain intact #
  22. ##############################################################################
  23. # Define Variables                                                           #
  24. #     Detailed Information Found In README File.                            #
  25.  
  26. # $mailprog defines the location of your sendmail program on your unix       #
  27. # system.                                                                    #
  28.  
  29. $mailprog = '/usr/lib/sendmail';
  30.  
  31. # @referers allows forms to be located only on servers which are defined     #
  32. # in this field.  This security fix from the last version which allowed      #
  33. # anyone on any server to use your FormMail script on their web site.        #
  34.  
  35. @referers = ('worldwidemart.com','206.31.72.203');
  36.  
  37. # Done                                                                       #
  38. ##############################################################################
  39.  
  40. # Check Referring URL
  41. &check_url;
  42.  
  43. # Retrieve Date
  44. &get_date;
  45.  
  46. # Parse Form Contents
  47. &parse_form;
  48.  
  49. # Check Required Fields
  50. &check_required;
  51.  
  52. # Return HTML Page or Redirect User
  53. &return_html;
  54.  
  55. # Send E-Mail
  56. &send_mail;
  57.  
  58. sub check_url {
  59.  
  60.     # Localize the check_referer flag which determines if user is valid.     #
  61.     local($check_referer) = 0;
  62.  
  63.     # If a referring URL was specified, for each valid referer, make sure    #
  64.     # that a valid referring URL was passed to FormMail.                     #
  65.  
  66.     if ($ENV{'HTTP_REFERER'}) {
  67.         foreach $referer (@referers) {
  68.             if ($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$referer|i) {
  69.                 $check_referer = 1;
  70.                 last;
  71.             }
  72.         }
  73.     }
  74.     else {
  75.         $check_referer = 1;
  76.     }
  77.  
  78.     # If the HTTP_REFERER was invalid, send back an error.                   #
  79.     if ($check_referer != 1) { &error('bad_referer') }
  80. }
  81.  
  82. sub get_date {
  83.  
  84.     # Define arrays for the day of the week and month of the year.           #
  85.     @days   = ('Sunday','Monday','Tuesday','Wednesday',
  86.                'Thursday','Friday','Saturday');
  87.     @months = ('January','February','March','April','May','June','July',
  88.              'August','September','October','November','December');
  89.  
  90.     # Get the current time and format the hour, minutes and seconds.  Add    #
  91.     # 1900 to the year to get the full 4 digit year.                         #
  92.     ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
  93.     $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
  94.     $year += 1900;
  95.  
  96.     # Format the date.                                                       #
  97.     $date = "$days[$wday], $months[$mon] $mday, $year at $time";
  98.  
  99. }
  100.  
  101. sub parse_form {
  102.  
  103.     # Define the configuration associative array.                            #
  104.     %Config = ('recipient','',          'subject','',
  105.                'email','',              'realname','',
  106.                'redirect','',           'bgcolor','',
  107.                'background','',         'link_color','',
  108.                'vlink_color','',        'text_color','',
  109.                'alink_color','',        'title','',
  110.                'sort','',               'print_config','',
  111.                'required','',           'env_report','',
  112.                'return_link_title','',  'return_link_url','',
  113.                'print_blank_fields','', 'missing_fields_redirect','');
  114.  
  115.     # Determine the form's REQUEST_METHOD (GET or POST) and split the form   #
  116.     # fields up into their name-value pairs.  If the REQUEST_METHOD was      #
  117.     # not GET or POST, send an error.                                        #
  118.     if ($ENV{'REQUEST_METHOD'} eq 'GET') {
  119.         # Split the name-value pairs
  120.         @pairs = split(/&/, $ENV{'QUERY_STRING'});
  121.     }
  122.     elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
  123.         # Get the input
  124.         read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
  125.  
  126.         # Split the name-value pairs
  127.         @pairs = split(/&/, $buffer);
  128.     }
  129.     else {
  130.         &error('request_method');
  131.     }
  132.  
  133.     # For each name-value pair:                                              #
  134.     foreach $pair (@pairs) {
  135.  
  136.         # Split the pair up into individual variables.                       #
  137.         local($name, $value) = split(/=/, $pair);
  138.  
  139.         # Decode the form encoding on the name and value variables.          #
  140.         $name =~ tr/+/ /;
  141.         $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  142.  
  143.         $value =~ tr/+/ /;
  144.         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  145.  
  146.         # If they try to include server side includes, erase them, so they
  147.         # aren't a security risk if the html gets returned.  Another 
  148.         # security hole plugged up.
  149.         $value =~ s/<!--(.|\n)*-->//g;
  150.  
  151.         # If the field name has been specified in the %Config array, it will #
  152.         # return a 1 for defined($Config{$name}}) and we should associate    #
  153.         # this value with the appropriate configuration variable.  If this   #
  154.         # is not a configuration form field, put it into the associative     #
  155.         # array %Form, appending the value with a ', ' if there is already a #
  156.         # value present.  We also save the order of the form fields in the   #
  157.         # @Field_Order array so we can use this order for the generic sort.  #
  158.         if (defined($Config{$name})) {
  159.             $Config{$name} = $value;
  160.         }
  161.         else {
  162.             if ($Form{$name} && $value) {
  163.                 $Form{$name} = "$Form{$name}, $value";
  164.             }
  165.             elsif ($value) {
  166.                 push(@Field_Order,$name);
  167.                 $Form{$name} = $value;
  168.             }
  169.         }
  170.     }
  171.  
  172.     # The next six lines remove any extra spaces or new lines from the       #
  173.     # configuration variables, which may have been caused if your editor     #
  174.     # wraps lines after a certain length or if you used spaces between field #
  175.     # names or environment variables.                                        #
  176.     $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
  177.     $Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
  178.     $Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
  179.     $Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
  180.     $Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
  181.     $Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
  182.  
  183.     # Split the configuration variables into individual field names.         #
  184.     @Required = split(/,/,$Config{'required'});
  185.     @Env_Report = split(/,/,$Config{'env_report'});
  186.     @Print_Config = split(/,/,$Config{'print_config'});
  187. }
  188.  
  189. sub check_required {
  190.  
  191.     # Localize the variables used in this subroutine.                        #
  192.     local($require, @error);
  193.  
  194.     if (!$Config{'recipient'}) {
  195.         if (!defined(%Form)) { &error('bad_referer') }
  196.         else                 { &error('no_recipient') }
  197.     }
  198.  
  199.     # For each require field defined in the form:                            #
  200.     foreach $require (@Required) {
  201.  
  202.         # If the required field is the email field, the syntax of the email  #
  203.         # address if checked to make sure it passes a valid syntax.          #
  204.         if ($require eq 'email' && !&check_email($Config{$require})) {
  205.             push(@error,$require);
  206.         }
  207.  
  208.         # Otherwise, if the required field is a configuration field and it   #
  209.         # has no value or has been filled in with a space, send an error.    #
  210.         elsif (defined($Config{$require})) {
  211.             if (!$Config{$require}) {
  212.                 push(@error,$require);
  213.             }
  214.         }
  215.  
  216.         # If it is a regular form field which has not been filled in or      #
  217.         # filled in with a space, flag it as an error field.                 #
  218.         elsif (!$Form{$require}) {
  219.             push(@error,$require);
  220.         }
  221.     }
  222.  
  223.     # If any error fields have been found, send error message to the user.   #
  224.     if (@error) { &error('missing_fields', @error) }
  225. }
  226.  
  227. sub return_html {
  228.     # Local variables used in this subroutine initialized.                   #
  229.     local($key,$sort_order,$sorted_field);
  230.  
  231.     # If redirect option is used, print the redirectional location header.   #
  232.     if ($Config{'redirect'}) {
  233.         print "Location: $Config{'redirect'}\n\n";
  234.     }
  235.  
  236.     # Otherwise, begin printing the response page.                           #
  237.     else {
  238.  
  239.         # Print HTTP header and opening HTML tags.                           #
  240.         print "Content-type: text/html\n\n";
  241.         print "<html>\n <head>\n";
  242.  
  243.         # Print out title of page                                            #
  244.         if ($Config{'title'}) { print "  <title>$Config{'title'}</title>\n" }
  245.         else                  { print "  <title>Thank You</title>\n"        }
  246.  
  247.         print " </head>\n <body";
  248.  
  249.         # Get Body Tag Attributes                                            #
  250.         &body_attributes;
  251.  
  252.         # Close Body Tag                                                     #
  253.         print ">\n  <center>\n";
  254.  
  255.         # Print custom or generic title.                                     #
  256.         if ($Config{'title'}) { print "   <h1>$Config{'title'}</h1>\n" }
  257.         else { print "   <h1>Thank You For Filling Out This Form</h1>\n" }
  258.  
  259.         print "</center>\n";
  260.  
  261.         print "Below is what you submitted to $Config{'recipient'} on ";
  262.         print "$date<p><hr size=1 width=75\%><p>\n";
  263.  
  264.         # Sort alphabetically if specified:                                  #
  265.         if ($Config{'sort'} eq 'alphabetic') {
  266.             foreach $field (sort keys %Form) {
  267.  
  268.                 # If the field has a value or the print blank fields option  #
  269.                 # is turned on, print out the form field and value.          #
  270.                 if ($Config{'print_blank_fields'} || $Form{$field}) {
  271.                     print "<b>$field:</b> $Form{$field}<p>\n";
  272.                 }
  273.             }
  274.         }
  275.  
  276.         # If a sort order is specified, sort the form fields based on that.  #
  277.         elsif ($Config{'sort'} =~ /^order:.*,.*/) {
  278.  
  279.             # Set the temporary $sort_order variable to the sorting order,   #
  280.             # remove extraneous line breaks and spaces, remove the order:    #
  281.             # directive and split the sort fields into an array.             #
  282.             $sort_order = $Config{'sort'};
  283.             $sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
  284.             $sort_order =~ s/(\s+)?\n+(\s+)?//g;
  285.             $sort_order =~ s/order://;
  286.             @sorted_fields = split(/,/, $sort_order);
  287.  
  288.             # For each sorted field, if it has a value or the print blank    #
  289.             # fields option is turned on print the form field and value.     #
  290.             foreach $sorted_field (@sorted_fields) {
  291.                 if ($Config{'print_blank_fields'} || $Form{$sorted_field}) {
  292.                     print "<b>$sorted_field:</b> $Form{$sorted_field}<p>\n";
  293.                 }
  294.             }
  295.         }
  296.  
  297.         # Otherwise, default to the order in which the fields were sent.     #
  298.         else {
  299.  
  300.             # For each form field, if it has a value or the print blank      #
  301.             # fields option is turned on print the form field and value.     #
  302.             foreach $field (@Field_Order) {
  303.                 if ($Config{'print_blank_fields'} || $Form{$field}) {
  304.                     print "<b>$field:</b> $Form{$field}<p>\n";
  305.                 }
  306.             }
  307.         }
  308.  
  309.         print "<p><hr size=1 width=75%><p>\n";
  310.  
  311.         # Check for a Return Link and print one if found.                    #
  312.         if ($Config{'return_link_url'} && $Config{'return_link_title'}) {
  313.             print "<ul>\n";
  314.             print "<li><a href=\"$Config{'return_link_url'}\">$Config{'return_link_title'}</a>\n";
  315.             print "</ul>\n";
  316.         }
  317.  
  318.         # Print the page footer.                                             #
  319.         print <<"(END HTML FOOTER)";
  320.         <hr size=1 width=75%><p> 
  321.         <center><font size=-1><a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a> V1.6 © 1995 -1997  Matt Wright<br>
  322. A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive, Inc.</a></font></center>
  323.         </body>
  324.        </html>
  325. (END HTML FOOTER)
  326.     }
  327. }
  328.  
  329. sub send_mail {
  330.     # Localize variables used in this subroutine.                            #
  331.     local($print_config,$key,$sort_order,$sorted_field,$env_report);
  332.  
  333.     # Open The Mail Program
  334.     open(MAIL,"|$mailprog -t");
  335.  
  336.     print MAIL "To: $Config{'recipient'}\n";
  337.     print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
  338.  
  339.     # Check for Message Subject
  340.     if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
  341.     else                    { print MAIL "Subject: WWW Form Submission\n\n" }
  342.  
  343.     print MAIL "Below is the result of your feedback form.  It was submitted by\n";
  344.     print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
  345.     print MAIL "-" x 75 . "\n\n";
  346.  
  347.     if (@Print_Config) {
  348.         foreach $print_config (@Print_Config) {
  349.             if ($Config{$print_config}) {
  350.                 print MAIL "$print_config: $Config{$print_config}\n\n";
  351.             }
  352.         }
  353.     }
  354.  
  355.     # Sort alphabetically if specified:                                      #
  356.     if ($Config{'sort'} eq 'alphabetic') {
  357.         foreach $field (sort keys %Form) {
  358.  
  359.             # If the field has a value or the print blank fields option      #
  360.             # is turned on, print out the form field and value.              #
  361.             if ($Config{'print_blank_fields'} || $Form{$field} ||
  362.                 $Form{$field} eq '0') {
  363.                 print MAIL "$field: $Form{$field}\n\n";
  364.             }
  365.         }
  366.     }
  367.  
  368.     # If a sort order is specified, sort the form fields based on that.      #
  369.     elsif ($Config{'sort'} =~ /^order:.*,.*/) {
  370.  
  371.         # Remove extraneous line breaks and spaces, remove the order:        #
  372.         # directive and split the sort fields into an array.                 #
  373.         $Config{'sort'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
  374.         $Config{'sort'} =~ s/(\s+)?\n+(\s+)?//g;
  375.         $Config{'sort'} =~ s/order://;
  376.         @sorted_fields = split(/,/, $Config{'sort'});
  377.  
  378.         # For each sorted field, if it has a value or the print blank        #
  379.         # fields option is turned on print the form field and value.         #
  380.         foreach $sorted_field (@sorted_fields) {
  381.             if ($Config{'print_blank_fields'} || $Form{$sorted_field} ||
  382.                 $Form{$sorted_field} eq '0') {
  383.                 print MAIL "$sorted_field: $Form{$sorted_field}\n\n";
  384.             }
  385.         }
  386.     }
  387.  
  388.     # Otherwise, default to the order in which the fields were sent.         #
  389.     else {
  390.  
  391.         # For each form field, if it has a value or the print blank          #
  392.         # fields option is turned on print the form field and value.         #
  393.         foreach $field (@Field_Order) {
  394.             if ($Config{'print_blank_fields'} || $Form{$field} ||
  395.                 $Form{$field} eq '0') {
  396.                 print MAIL "$field: $Form{$field}\n\n";
  397.             }
  398.         }
  399.     }
  400.  
  401.     print MAIL "-" x 75 . "\n\n";
  402.  
  403.     # Send any specified Environment Variables to recipient.                 #
  404.     foreach $env_report (@Env_Report) {
  405.         if ($ENV{$env_report}) {
  406.             print MAIL "$env_report: $ENV{$env_report}\n";
  407.         }
  408.     }
  409.  
  410.     close (MAIL);
  411. }
  412.  
  413. sub check_email {
  414.     # Initialize local email variable with input to subroutine.              #
  415.     $email = $_[0];
  416.  
  417.     # If the e-mail address contains:                                        #
  418.     if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
  419.  
  420.         # the e-mail address contains an invalid syntax.  Or, if the         #
  421.         # syntax does not match the following regular expression pattern     #
  422.         # it fails basic syntax verification.                                #
  423.  
  424.         $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
  425.  
  426.         # Basic syntax requires:  one or more characters before the @ sign,  #
  427.         # followed by an optional '[', then any number of letters, numbers,  #
  428.         # dashes or periods (valid domain/IP characters) ending in a period  #
  429.         # and then 2 or 3 letters (for domain suffixes) or 1 to 3 numbers    #
  430.         # (for IP addresses).  An ending bracket is also allowed as it is    #
  431.         # valid syntax to have an email address like: user@[255.255.255.0]   #
  432.  
  433.         # Return a false value, since the e-mail address did not pass valid  #
  434.         # syntax.                                                            #
  435.         return 0;
  436.     }
  437.  
  438.     else {
  439.  
  440.         # Return a true value, e-mail verification passed.                   #
  441.         return 1;
  442.     }
  443. }
  444.  
  445. sub body_attributes {
  446.     # Check for Background Color
  447.     if ($Config{'bgcolor'}) { print " bgcolor=\"$Config{'bgcolor'}\"" }
  448.  
  449.     # Check for Background Image
  450.     if ($Config{'background'}) { print " background=\"$Config{'background'}\"" }
  451.  
  452.     # Check for Link Color
  453.     if ($Config{'link_color'}) { print " link=\"$Config{'link_color'}\"" }
  454.  
  455.     # Check for Visited Link Color
  456.     if ($Config{'vlink_color'}) { print " vlink=\"$Config{'vlink_color'}\"" }
  457.  
  458.     # Check for Active Link Color
  459.     if ($Config{'alink_color'}) { print " alink=\"$Config{'alink_color'}\"" }
  460.  
  461.     # Check for Body Text Color
  462.     if ($Config{'text_color'}) { print " text=\"$Config{'text_color'}\"" }
  463. }
  464.  
  465. sub error { 
  466.     # Localize variables and assign subroutine input.                        #
  467.     local($error,@error_fields) = @_;
  468.     local($host,$missing_field,$missing_field_list);
  469.  
  470.     if ($error eq 'bad_referer') {
  471.         if ($ENV{'HTTP_REFERER'} =~ m|^https?://([\w\.]+)|i) {
  472.             $host = $1;
  473.             print <<"(END ERROR HTML)";
  474. Content-type: text/html
  475.  
  476. <html>
  477.  <head>
  478.   <title>Bad Referrer - Access Denied</title>
  479.  </head>
  480.  <body bgcolor=#FFFFFF text=#000000>
  481.   <center>
  482.    <table border=0 width=600 bgcolor=#9C9C9C>
  483.     <tr><th><font size=+2>Bad Referrer - Access Denied</font></th></tr>
  484.    </table>
  485.    <table border=0 width=600 bgcolor=#CFCFCF>
  486.     <tr><td>The form attempting to use
  487.      <a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a>
  488.      resides at <tt>$ENV{'HTTP_REFERER'}</tt>, which is not allowed to access
  489.      this cgi script.<p>
  490.  
  491.      If you are attempting to configure FormMail to run with this form, you need
  492.      to add the following to \@referers, explained in detail in the README file.<p>
  493.  
  494.      Add <tt>'$host'</tt> to your <tt><b>\@referers</b></tt> array.<hr size=1>
  495.      <center><font size=-1>
  496.       <a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a> V1.6 © 1995 - 1997  Matt Wright<br>
  497.       A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive, Inc.</a>
  498.      </font></center>
  499.     </td></tr>
  500.    </table>
  501.   </center>
  502.  </body>
  503. </html>
  504. (END ERROR HTML)
  505.         }
  506.         else {
  507.             print <<"(END ERROR HTML)";
  508. Content-type: text/html
  509.  
  510. <html>
  511.  <head>
  512.   <title>FormMail v1.6</title>
  513.  </head>
  514.  <body bgcolor=#FFFFFF text=#000000>
  515.   <center>
  516.    <table border=0 width=600 bgcolor=#9C9C9C>
  517.     <tr><th><font size=+2>FormMail</font></th></tr>
  518.    </table>
  519.    <table border=0 width=600 bgcolor=#CFCFCF>
  520.     <tr><th><tt><font size=+1>Copyright 1995 - 1997 Matt Wright<br>
  521.         Version 1.6 - Released May 02, 1997<br>
  522.         A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive,
  523.         Inc.</a></font></tt></th></tr>
  524.    </table>
  525.   </center>
  526.  </body>
  527. </html>
  528. (END ERROR HTML)
  529.         }
  530.     }
  531.  
  532.     elsif ($error eq 'request_method') {
  533.             print <<"(END ERROR HTML)";
  534. Content-type: text/html
  535.  
  536. <html>
  537.  <head>
  538.   <title>Error: Request Method</title>
  539.  </head>
  540.  <body bgcolor=#FFFFFF text=#000000>
  541.   <center>
  542.    <table border=0 width=600 bgcolor=#9C9C9C>
  543.     <tr><th><font size=+2>Error: Request Method</font></th></tr>
  544.    </table>
  545.    <table border=0 width=600 bgcolor=#CFCFCF>
  546.     <tr><td>The Request Method of the Form you submitted did not match
  547.      either <tt>GET</tt> or <tt>POST</tt>.  Please check the form and make sure the
  548.      <tt>method=</tt> statement is in upper case and matches <tt>GET</tt> or <tt>POST</tt>.<p>
  549.  
  550.      <center><font size=-1>
  551.       <a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a> V1.6 © 1995 - 1997  Matt Wright<br>
  552.       A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive, Inc.</a>
  553.      </font></center>
  554.     </td></tr>
  555.    </table>
  556.   </center>
  557.  </body>
  558. </html>
  559. (END ERROR HTML)
  560.     }
  561.  
  562.     elsif ($error eq 'no_recipient') {
  563.             print <<"(END ERROR HTML)";
  564. Content-type: text/html
  565.  
  566. <html>
  567.  <head>
  568.   <title>Error: No Recipient</title>
  569.  </head>
  570.  <body bgcolor=#FFFFFF text=#000000>
  571.   <center>
  572.    <table border=0 width=600 bgcolor=#9C9C9C>
  573.     <tr><th><font size=+2>Error: No Recipient</font></th></tr>
  574.    </table>
  575.    <table border=0 width=600 bgcolor=#CFCFCF>
  576.     <tr><td>No Recipient was specified in the data sent to FormMail.  Please
  577.      make sure you have filled in the 'recipient' form field with an e-mail
  578.      address.  More information on filling in recipient form fields can be
  579.      found in the README file.<hr size=1>
  580.  
  581.      <center><font size=-1>
  582.       <a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a> V1.6 © 1995 - 1997  Matt Wright<br>
  583.       A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive, Inc.</a>
  584.      </font></center>
  585.     </td></tr>
  586.    </table>
  587.   </center>
  588.  </body>
  589. </html>
  590. (END ERROR HTML)
  591.     }
  592.  
  593.     elsif ($error eq 'missing_fields') {
  594.         if ($Config{'missing_fields_redirect'}) {
  595.             print "Location: $Config{'missing_fields_redirect'}\n\n";
  596.         }
  597.         else {
  598.             foreach $missing_field (@error_fields) {
  599.                 $missing_field_list .= "      <li>$missing_field\n";
  600.             }
  601.  
  602.             print <<"(END ERROR HTML)";
  603. Content-type: text/html
  604.  
  605. <html>
  606.  <head>
  607.   <title>Error: Blank Fields</title>
  608.  </head>
  609.   <center>
  610.    <table border=0 width=600 bgcolor=#9C9C9C>
  611.     <tr><th><font size=+2>Error: Blank Fields</font></th></tr>
  612.    </table>
  613.    <table border=0 width=600 bgcolor=#CFCFCF>
  614.     <tr><td>The following fields were left blank in your submission form:<p>
  615.      <ul>
  616. $missing_field_list
  617.      </ul><br>
  618.  
  619.      These fields must be filled in before you can successfully submit the form.<p>
  620.      Please use your browser's back button to return to the form and try again.<hr size=1>
  621.      <center><font size=-1>
  622.       <a href="http://www.worldwidemart.com/scripts/formmail.shtml">FormMail</a> V1.6 © 1995 - 1997  Matt Wright<br>
  623.       A Free Product of <a href="http://www.worldwidemart.com/scripts/">Matt's Script Archive, Inc.</a>
  624.      </font></center>
  625.     </td></tr>
  626.    </table>
  627.   </center>
  628.  </body>
  629. </html>
  630. (END ERROR HTML)
  631.         }
  632.     }
  633.     exit;
  634. }
  635.  
  636.